from django.contrib.auth.models import Group, Permission
from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet

from meiduo_admin.serializers.group import GroupsSerialzier, PermissionSimpleSerialzier
from meiduo_admin.utils import PageNum

# 分组表数据管理
class GroupsView(ModelViewSet):
    serializer_class = GroupsSerialzier
    queryset = Group.objects.all().order_by("id")
    pagination_class = PageNum

# 获取权限表数据
class PermissionSimple(ListAPIView):
    serializer_class = PermissionSimpleSerialzier
    queryset = Permission.objects.all()
    # pagination_class = PageNum
